package com.erhirent.view;

import com.erhirent.bean.carUsers;

public class registerView extends View {

	public registerView() {
	}

	private boolean isContinue = true;

	@Override
	public View showView() {

		// 判断
		for (; isContinue;) {
			System.out.println("欢迎来到注册界面");
			System.out.println("你的昵称:");
			String Name = mScanner.next();

			// 判断昵称是否存在isname
			if (muser.isname(Name)) {
				System.out.println("请设置密码:");
				String Pwd1 = mScanner.next();
				System.out.println("请重新输入密码:");
				String Pwd2 = mScanner.next();
				if (Pwd1.equals(Pwd2)) {
					carUsers users = new carUsers(Name, Pwd1);
					muser.addUser(users);
					System.out.println("添加成功");
					isContinue = false;
				} else {
					System.out.println("密码不一致,重新来过");
					return showView();
				}

			}
			return showView();

		}
		return new loginView();
	}
}
